<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="style/editor.css" rel="stylesheet" type="text/css">
<script>
  var sLangDir=parent.oUtil.langDir;
  document.write("<scr"+"ipt src='language/"+sLangDir+"/image_background.js'></scr"+"ipt>");
</script>
<script>writeTitle()</script>
<script>

var dialogArguments = ['openerWin', 'parent'];
var preview = window.location.search.substr(1);

function bodyOnLoad()
  {
  loadTxt();

  var oCell = eval(dialogArguments[0]+".document.getElementById('"+preview+"')");;

  sImgUrl=oCell.style.backgroundImage;
  if(sImgUrl=="none")sImgUrl="";
  else sImgUrl=sImgUrl.substring(4,sImgUrl.length-1);
  inpCell_BgImgURL.value=sImgUrl;

  inpCell_BgImgRepeat.value=oCell.style.backgroundRepeat;

  if(oCell.style.backgroundPositionX=="left"||oCell.style.backgroundPositionX=="center"||oCell.style.backgroundPositionX=="right")
    {
    inpCell_BgImgHAlign[0].checked=true;
    inpCell_BgImgHAlignPos.value=oCell.style.backgroundPositionX;
    }
  else
    {
    var sPosX=oCell.style.backgroundPositionX;
    if(sPosX.substring(sPosX.length-1)=="%")
      {
      sPosXVal=sPosX.substring(0,sPosX.length-1);
      if(sPosXVal*1!=0)
        {
        inpCell_BgImgHAlign[1].checked=true;
        inpCell_BgImgHAlignVal.value=sPosXVal;
        inpCell_BgImgHAlignMeasure.value="%";
        }
      }
    else if(sPosX.substring(sPosX.length-2)=="px")
      {
      sPosXVal=sPosX.substring(0,sPosX.length-2);
      if(sPosXVal*1!=0)
        {
        inpCell_BgImgHAlign[1].checked=true;
        inpCell_BgImgHAlignVal.value=sPosXVal;
        inpCell_BgImgHAlignMeasure.value="px";
        }
      }
    }

  if(oCell.style.backgroundPositionY=="top"||oCell.style.backgroundPositionY=="middle"||oCell.style.backgroundPositionY=="bottom")
    {
    inpCell_BgImgVAlign[0].checked=true;
    inpCell_BgImgVAlignPos.value=oCell.style.backgroundPositionY;
    }
  else
    {
    var sPosY=oCell.style.backgroundPositionY;

    if(sPosY.substring(sPosY.length-1)=="%")
      {
      sPosYVal=sPosY.substring(0,sPosY.length-1);
      if(sPosYVal*1!=0)
        {
        inpCell_BgImgVAlign[1].checked=true;
        inpCell_BgImgVAlignVal.value=sPosYVal;
        inpCell_BgImgVAlignMeasure.value="%";
        }
      }
    else if(sPosY.substring(sPosY.length-2)=="px")
      {
      sPosYVal=sPosY.substring(0,sPosY.length-2);
      if(sPosYVal*1!=0)
        {
        inpCell_BgImgVAlign[1].checked=true;
        inpCell_BgImgVAlignVal.value=sPosYVal;
        inpCell_BgImgVAlignMeasure.value="px";
        }
      }
    }

  if(eval(dialogArguments[1]).oUtil.obj.cmdAssetManager!="")btnAsset.style.display="block";
  if(eval(dialogArguments[1]).oUtil.obj.cmdImageManager!="")btnAsset.style.display="block";
  }
function openAsset()
    {
    if(eval(dialogArguments[1]).oUtil.obj.cmdAssetManager!="")
    var a = eval(dialogArguments[1] + ".oUtil.obj.cmdAssetManager");
  if(eval(dialogArguments[1]).oUtil.obj.cmdImageManager!="")
    var a = eval(dialogArguments[1] + ".oUtil.obj.cmdImageManager");
    eval(a);
    }
function setAssetValue(v)
    {
    document.getElementById("inpCell_BgImgURL").value = v;
    }
function modalDialogShow(url,width,height)
  {
    parent.modalDialogShow(url,width,height, window);
  }

function doApply()
  {
  var oCell = eval(dialogArguments[0]+".document.getElementById('"+preview+"')");;

  sColor = oCell.style.backgroundColor;

  if(inpCell_BgImgVAlign[0].checked) sVAlign = inpCell_BgImgVAlignPos.value;
  else if(inpCell_BgImgVAlign[1].checked) sVAlign = inpCell_BgImgVAlignVal.value + inpCell_BgImgVAlignMeasure.value;
  else sVAlign = "";

  if(inpCell_BgImgHAlign[0].checked) sHAlign = inpCell_BgImgHAlignPos.value;
  else if(inpCell_BgImgHAlign[1].checked) sHAlign = inpCell_BgImgHAlignVal.value + inpCell_BgImgHAlignMeasure.value;
  else sHAlign = "";

  if(inpCell_BgImgURL.value=="") oCell.style.background=sColor;
  else oCell.style.background = "url("+inpCell_BgImgURL.value+") " + sColor + " " + inpCell_BgImgRepeat.value + " "+sHAlign+" "+sVAlign;
  }
</script>
</head>
<body style="overflow:hidden;">

<table width=100% height="160px" align=center cellpadding=0 cellspacing=0>
<tr>
<td valign=top style="padding:5px;">

  <table width=100%>
  <tr>
    <td nowrap><span id=txtLang name=txtLang>Image Source</span>: </td>
    <td style="width:100%">
        <table cellpadding="0" cellspacing="0"  style="width:100%" style="border-collapse:separate">
        <tr>
        <td style="width:100%;padding-right:5px;"><input type="text" id="inpCell_BgImgURL" name=inpCell_BgImgURL style="width:100%" class="inpTxt" /></td>
        <td><input type="button" value="" onclick="openAsset()" id="btnAsset" name="btnAsset" style="display:none;background:url('openAsset.gif') center center no-repeat;width:23px;height:18px;border:#a5acb2 1px solid;margin-left:1px;"></td>
        </tr>
        </table>
    </td>
  </tr>
  <tr>
    <td nowrap><span id=txtLang name=txtLang>Repeat</span>: </td>
    <td>
      <select name=inpCell_BgImgRepeat ID=inpCell_BgImgRepeat class="inpSel">
        <option value=repeat id="optLang" name="optLang" selected>Repeat</option>
        <option value=no-repeat id="optLang" name="optLang">No repeat</option>
        <option value=repeat-x id="optLang" name="optLang">Repeat horizontally</option>
        <option value=repeat-y id="optLang" name="optLang">Repeat vertically</option>
      </select>
    </td>
  </tr>
  <tr>
  <td nowrap><span id=txtLang name=txtLang>Horizontal Align</span>: &nbsp;</td>
  <td>
      <input type=radio name=inpCell_BgImgHAlign class=inpRdo checked>
      <select name=inpCell_BgImgHAlignPos  style="width:70px" class="inpSel">
        <option value=left id="optLang" name="optLang" selected>left</option>
        <option value=center id="optLang" name="optLang">center</option>
        <option value=right id="optLang" name="optLang">right</option>
      </select>

      <input type=radio name=inpCell_BgImgHAlign class=inpRdo>
      <input type=text name=inpCell_BgImgHAlignVal size=3 class="inpTxt">
      <select name=inpCell_BgImgHAlignMeasure style="width:70px" class="inpSel">
        <option value=px id="optLang" name="optLang">pixels</option>
        <option value="%" id="optLang" name="optLang">percent</option>
      </select>
  </td>
  </tr>
  <tr>
  <td nowrap><span id=txtLang name=txtLang>Vertical Align</span>: </td>
  <td>
    <input type=radio name=inpCell_BgImgVAlign class=inpRdo checked>
    <select name=inpCell_BgImgVAlignPos style="width:70px" class="inpSel">
      <option value=top id="optLang" name="optLang" selected>top</option>
      <option value=middle id="optLang" name="optLang">middle</option>
      <option value=bottom id="optLang" name="optLang">bottom</option>
    </select>

    <input type=radio name=inpCell_BgImgVAlign class=inpRdo>
    <input type=text name=inpCell_BgImgVAlignVal size=3 class="inpTxt">
    <select name=inpCell_BgImgVAlignMeasure style="width:70px" class="inpSel">
      <option value=px id="optLang" name="optLang">pixels</option>
      <option value="%" id="optLang" name="optLang">percent</option>
    </select>
  </td>
  </tr>
  </table>

</td>
</tr>
<tr>
<td class="dialogFooter" align="right">
  <table cellpadding=0 cellspacing=0>
  <tr>
  <td>
    <input type="button" name=btnCancel id=btnCancel value="cancel" onclick="self.closeWin()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
  </td>
  <td>
    <input type="button" name=btnOk id=btnOk value=" ok " onclick="doApply();self.closeWin()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
  </td>
  </tr>
  </table>
</td>
</tr>
</table>

</body>
</html>